import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/@/utils';
//列表数据
export const columns: BasicColumn[] = [

  {
    title: '名称',
    align: "center",
    dataIndex: 'name'
  },
  {
    title: '用户id',
    align: "center",
    dataIndex: 'userid'
  },

  {
    title: '手机号',
    align: "center",
    dataIndex: 'mobile'
  },
  {
    title: '职位',
    align: "center",
    dataIndex: 'title'
  },
  {
    title: '部门层级',
    align: "center",
    dataIndex: 'deptNames'
  },
  {
    title: '一级部门',
    align: "center",
    dataIndex: 'firstDept'
  },
  {
    title: '二级部门',
    align: "center",
    dataIndex: 'secondDept'
  },
  {
    title: '投票小组成员',
    align: "center",
    dataIndex: 'isVip',
    customRender: ({ text }) => {
      return render.renderSwitch(text, [{ text: '是', value: 'Y' }, { text: '否', value: 'N' }])
    },
  },
  {
    title: '权重',
    align: "center",
    dataIndex: 'priority'
  },
    {
    title: '价格监控成员',
    align: "center",
    dataIndex: 'isPriceMonitoring',
    customRender: ({ text }) => {
      return render.renderSwitch(text, [{ text: '是', value: 'Y' }, { text: '否', value: 'N' }])
    },
  },
  // {
  //   title: '头像',
  //   align: "center",
  //   dataIndex: 'avatar'
  // },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "名称",
    field: 'name',
    component: 'JInput',
    //colProps: {span: 6},
  },
  {
    label: "手机号",
    field: 'mobile',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "投票小组成员",
    field: 'isVip',
    component: 'JSwitch',
    componentProps: {
      query: true,
    },
    //colProps: {span: 6},
  },
    {
    label: "价格监控成员",
    field: 'isPriceMonitoring',
    component: 'JSwitch',
    componentProps: {
      query: true,
    },
    //colProps: {span: 6},
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  // {
  //   label: '用户id',
  //   field: 'userid',
  //   component: 'Input',
  // },
  {
    label: '名称',
    field: 'name',
    component: 'Input',
  },
  // {
  //   label: '头像',
  //   field: 'avatar',
  //   component: 'Input',
  // },
  {
    label: '手机号',
    field: 'mobile',
    component: 'Input',
  },
  {
    label: '职位',
    field: 'title',
    component: 'Input',
  },
  {
    label: '一级部门',
    field: 'firstDept',
    component: 'Input',
  },
  {
    label: '二级部门',
    field: 'secondDept',
    component: 'Input',
  },
  {
    label: '投票小组成员',
    field: 'isVip',
    component: 'JSwitch',
    componentProps: {
    },
  },
    {
    label: '权重',
    field: 'priority',
    component: 'Input',
  },
    {
    label: '价格监控成员',
    field: 'isPriceMonitoring',
    component: 'JSwitch',
    componentProps: {
    },
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false
  },
];

// 高级查询数据
export const superQuerySchema = {
  userid: { title: '用户id', order: 0, view: 'text', type: 'string', },
  name: { title: '名称', order: 1, view: 'text', type: 'string', },
  avatar: { title: '头像', order: 2, view: 'text', type: 'string', },
  mobile: { title: '手机号', order: 3, view: 'text', type: 'string', },
  title: { title: '职位', order: 4, view: 'text', type: 'string', },
  isVip: { title: '投票小组成员', order: 5, view: 'switch', type: 'string', },
};

/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}